<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
</head>
<body>
<div th:replace="~{fragments/header :: header}">...</div>


<div th:if="${message}">
    <h2 th:text="${message}"/>
</div>

<div>
    <form method="POST" enctype="multipart/form-data" action="/">
        <table>
            <tr>
                <td><a class="btn btn-primary" href="/">首页</a></td>
                <td>File to upload:</td>
                <td><input type="file" name="file"/></td>
                <td><input class="btn btn-success" type="submit" value="上传"/></td>
            </tr>
        </table>
    </form>
</div>
<br/>
<div>
    <table border="1" class="table table-striped table-bordered table-hover">
        <thead class="thead-dark">
        <tr>
            <td>Name</td>
            <td>ID</td>
            <td>contentType</td>
            <td>size</td>
            <td>uploadDate</td>
            <td>md5</td>
            <td>delete</td>
        </tr>
        </thead>
        <tbody>
        <tr th:if="${files.size()} eq 0" class="table-active">
            <td colspan="3">没有文件信息！！</td>
        </tr>
        <tr th:each="file : ${files}" class="table-active">
            <td><a th:href="'view/'+${file.id}" th:text="${file.name}"/></td>
            <td th:text="${file.id}"></td>
            <td th:text="${file.contentType}"></td>
            <td th:text="${file.size}"></td>
            <td th:text="${file.uploadDate}"></td>
            <td th:text="${file.md5}"></td>
            <td>
                <div>
                    <a th:href="'view/'+${file.id}"  style="text-align:center;"><i class="btn btn-danger">查看</i></a>
                    <a th:href="'files/'+${file.id}"  style="text-align:center;"><i class="btn btn-danger">下载</i></a>
                    <a onclick="deleteImg(this)" th:id="${file.id}" style="text-align:center;"><i
                            class="btn btn-danger">删除</i></a>
                </div>
            </td>
            <!--            <td onclick="downloadImg(this)" th:id="${file.id}" style="text-align:center;"><i class="btn btn-danger">下载</i></td>-->
            <!--            <td onclick="deleteImg(this)" th:id="${file.id}" style="text-align:center;"><i class="btn btn-danger">删除</i></td>-->
        </tr>
        </tbody>
    </table>
</div>

<div th:replace="~{fragments/footer :: footer}">...</div>
</body>
</html>
